import request from '../api';
import qs from 'qs'

export const getList = async (token) => {
  const res = await request.get(`/listuser?token=${token}`);
  return res.data.data.list;
};

export const update = async (token, detail) => {
  const {userid} = detail;
  return await request.request({
    url: `/saveuser?token=${token}&userid=${userid}`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(detail)
  });
};

export const quit = async (token, id) => {
  return await request.request({
    url: `/userQuit?token=${token}&userid=${id}`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  });
};
